 /* Copyright (C)
  * 2024 ZKLX Optoelectronic Technology Co.LTD
  * All rights reserved.
  */
 /**
  * @file cgi_c_test.c
  * @brief 
  * @author xuke
  * @version 1.0
  * @date 2024-09-29
  */

#include <stdio.h>
#include <stdlib.h>

/*--------------------------------extern--------------------------------------------*/

/*--------------------------------globals-------------------------------------------*/

/*--------------------------------locals--------------------------------------------*/

/*--------------------------------funcs---------------------------------------------*/
int main(int argc, char *argv[])
{
	char szStr[512];
	char *p ;
	strcpy(szStr, "");
	printf("Content-type:text/html\n\n");
	printf("<html>\n");
	printf("<head><title>An html page from a cgi</title></head>\n");
	printf("<body>\n");
	printf("<h1>Board.Info</h1>\n");

	p = getenv("QUERY_STRING");
	if (p) {
		sprintf(szStr, "get: %s",getenv("QUERY_STRING")); //打印get获取的信息
		printf("%s", szStr);
	} else {
		gets(szStr);
		if (strcmp(szStr,"")!=0) {
			printf("post: %s",szStr); //打印post获取的信息
		}
	}
	printf("</body>\n");
	printf("</html>\n");
	fflush(stdout);
	return 0;
}

